import { defHttp } from '/@/utils/http/axios';
import { IPostAccountDeleteRequest } from '/@/types/system/basic/account/delete';
import { IPostAccountAddRequest } from '/@/types/system/basic/account/add';
import { IPostAccountUpdateRaw } from '/@/types/system/basic/account/update';
import { IPostAccountListRequest, IPostAccountListResponse } from '/@/types/system/basic/account/list';
import { IPostRawAccountDetailsResponse } from '/@/types/system/basic/account/details';
import { IGetAccountCheckNumberIsExistQuery } from '/@/types/system/basic/account/checkNumberIsExist';

/**
 * 删除账户
 */
export const apiPostAccountDelete = (params: IPostAccountDeleteRequest) => defHttp.post({ url: `/system/basic/account/delete`, params });
/**
 * 新增账户
 */
export const apiPostAccountAdd = (params: IPostAccountAddRequest) => defHttp.post({ url: `/system/basic/account/add`, params });
/**
 * 编辑账户
 */
export const apiPostAccountUpdatePath = (id: string | number, params: IPostAccountUpdateRaw) =>
  defHttp.post({ url: `/system/basic/account/update/${id}`, params });
/**
 * 账户列表
 */
export const apiPostAccountList = (params: IPostAccountListRequest) =>
  defHttp.post<IPostAccountListResponse>({ url: `/system/basic/account/list`, params });
/**
 * 账户详情
 */
export const apiPostAccountDetailsPath = (id: string | number) =>
  defHttp.post<IPostRawAccountDetailsResponse>({ url: `/system/basic/account/details/${id}` });
/**
 * 资金账户编号是否唯一
 */
export const apiGetAccountCheckNumberIsExistQuery = (params: IGetAccountCheckNumberIsExistQuery) =>
  defHttp.get({ url: `/system/basic/account/checkNumberIsExist`, params }, { joinParamsToUrl: true });
